package com.woniu.service.productcommand;

import com.woniu.outlet.mysql.po.Product;
import com.woniu.util.ApplicationContextHolder;
import lombok.Data;

/**
 * @description:
 * @author: my
 * @time: 2021/4/27 16:33
 */
@Data
public class UpdateProductCommand {
    private UpdateProductCommandHandler handler;
    private Product product;

    public UpdateProductCommand(){
        this.handler =
                ApplicationContextHolder.getApplicationContext().getBean(UpdateProductCommandHandler.class);
    }

    public UpdateProductCommand(Product product){
        this();
        this.product = product;
    }

    public void execute(){
        this.handler.action(this);
    }
}
